<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of news_model
 *
 * @author Administrator
 */
class News_model extends CI_Model {
    //put your code here
    public function __construct() {
        parent::__construct();
        $this->load->database();
    }
    
    public function select_news($id=''){
        if($id){
            $this->db->where('id',$id); 
        }
        $this->db->select('*');
        $query=$this->db->get('news');
        return $query->result();
    }
    
    public function insert_news($arr){
        $this->db->insert('news',$arr);
    }
    
    public function update_news($id,$arr){
        $this->db->where('id',$id);
        $this->db->update('news',$arr);
    }
    
    public function delete_news($id){
        $this->db->where('id',$id);
        $this->db->delete('news');
    }
}
